﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace DocumentsTagger.DM
{
    public static class DocumentsFactory
    {
        private static readonly Dictionary<string, Document> sr_Documents = new Dictionary<string, Document>();

        public static Document GetDocument(string FilePath, string FileName)
        {
            Document doc = null;
            string fullPath = Path.Combine(FilePath, FileName );
            if (sr_Documents.ContainsKey(fullPath))
            {
                doc = sr_Documents[fullPath];
            }
            else
            {
                doc = new Document(FileName, FilePath);
                sr_Documents.Add(fullPath, doc);
            }

            return doc;
        }
    }
}
